package com.chixing.day13_list.work;

public class Product {
    private int proId;
    private String proName;
    private double proPrice;

    public Product(){}
    public Product(int proId, String proName, double proPrice) {
        this.proId = proId;
        this.proName = proName;
        this.proPrice = proPrice;
    }

    public int getProId() {
        return proId;
    }

    public void setProId(int proId) {
        this.proId = proId;
    }

    public String getProName() {
        return proName;
    }

    public void setProName(String proName) {
        this.proName = proName;
    }

    public double getProPrice() {
        return proPrice;
    }

    public void setProPrice(double proPrice) {
        this.proPrice = proPrice;
    }

    @Override
    public String toString() {
        return "Product{" +
                "proId=" + proId +
                ", proName='" + proName + '\'' +
                ", proPrice=" + proPrice +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Product product = (Product) o;

        if (proId != product.proId) return false;
        return proName != null ? proName.equals(product.proName) : product.proName == null;
    }

    @Override
    public int hashCode() {
        int result = proId;
        result = 31 * result + (proName != null ? proName.hashCode() : 0);
        return result;
    }
}
